package com.library;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.ui.ModelMap;

import com.library.service.book.BookService;

@Controller
public class BooksController{
 
	@Autowired
    private BookService bookService;
	
	@RequestMapping(value="/books", method=RequestMethod.GET)
	public ModelAndView books(ModelMap model) {

		model.addAttribute("books", bookService.findAll());
		
		//return "books";
		return new ModelAndView("books");
   }

}